package com.whq.thrift.api.common.spring.datasource;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * 动态路由数据源
 *
 * @author wanghuaiqiang
 */
public class DynamicDataSource extends AbstractRoutingDataSource {
    /** 
     * 确定当前选择的数据源key 
     * <p> 
     * key由当前线程{@link DataSourceContextHolder#set(String)} 
     */  
    @Override  
    protected Object determineCurrentLookupKey() {  
        return DataSourceContextHolder.get();  
    }
}